package cn.neusoft.runoobcc.web.controller;


import cn.neusoft.baibang.result.JSONResult;
import cn.neusoft.runoobcc.doc.ProductDoc;
import cn.neusoft.runoobcc.service.IEsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/es")
@Slf4j
public class EsController {
    @Autowired
    private IEsService esService;

    @RequestMapping(value="/esOnline",method= RequestMethod.POST)
    public JSONResult PublishProduct(@RequestBody ProductDoc courseDoc){
        esService.PublishProduct(courseDoc);
        return JSONResult.success();
    }
    @RequestMapping(value="/esOffline",method= RequestMethod.POST)
    public JSONResult OffProduct(@RequestBody Long id){
        esService.OffProduct(id);
        return JSONResult.success();
    }


}
